package com.etc.admin.service.impl;

import java.util.List;

import javax.annotation.Resource;

import org.springframework.stereotype.Service;

import com.etc.admin.dao.OrderMapper;
import com.etc.admin.service.OrderService;
import com.etc.entity.Order;
import com.etc.util.PageData;
@Service("OrderService")
public class OrderServiceImpl implements OrderService{
	@Resource
  private OrderMapper orderMapper;
	/**
	 * 订单分页
	 */
	/*@Override
	public PageData<Order> getOrderByPage(int page, int pageSize, String content) {
		int start=(page-1)*pageSize;
		List<Order> data=orderMapper.getOrderByPage(start, pageSize, content);
		int count=orderMapper.getTotal(content);
		PageData<Order> pd=new PageData<>(data, count, pageSize, page);
		return pd;
	}*/
	/**
	 * 修改 订单
	 */
	@Override
	public boolean updateOrder(Order order) {
		return orderMapper.updateByPrimaryKeySelective(order)>0;
	}

	@Override
	public Order getOrderById(int orderid) {
		return orderMapper.selectByPrimaryKey(orderid);
	}
	//退房时，根据订单id,修改订单的状态
	@Override
	public boolean updateOrderById(int orderid,int orderstatus) {
		
		return orderMapper.updateOrderById(orderid,orderstatus);
	}
	//创建订单
	@Override
	public boolean insertSelective(Order order) {
		return orderMapper.insertSelective(order)>0;
	}

	@Override
	public int orderCount() {
		// TODO Auto-generated method stub
		return orderMapper.orderCount();
	}

	@Override
	public int totalTurnover() {
		// TODO Auto-generated method stub
		return orderMapper.totalTurnover();
	}

}
